package com.lab.jumper;

import com.cuitrip.business.home.IndexActivity;
import com.lab.app.BaseActivity;

import java.util.List;

/**
 * Created by ak
 */
public class JumperManager {

    private static JumperManager sInstance;

    public static JumperManager getInstance() {
        if (null == sInstance)
            sInstance = new JumperManager();
        return sInstance;
    }

    private JumperManager() {
    }

    public IndexActivity getIndexActivityIfExist() {
        IndexActivity homeActivity = null;
        // 遍历Activity堆栈,尝试获取IndexActivity
        List<BaseActivity> activityList = ActivityManager.getInstance().getAllActivity();
        if (null != activityList) {
            for (BaseActivity activity : activityList) {
                if (null != activity && activity instanceof IndexActivity) {
                    homeActivity = (IndexActivity) activity;
                    break;
                }
            }
        }
        return homeActivity;
    }


}
